﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace jqwidgetsapi.Models
{
    public class oSeries
    {
        public int total { get; set; }
        public List<DataPoint> rows { get; set; }      
    }

    public class DataPoint
    {
        [Required]
        public int Id { get; set; }
        [Required]
        public decimal X { get; set; }
        public decimal? Y { get; set; }
        [Required]
        public string XLabel { get; set; }
        public string YLabel { get; set; }
        public string Notes { get; set; }
    }

    public class Series
    {
        private List<DataPoint> _seriesPoints;
        public List<DataPoint> SeriesPoints { get { return _seriesPoints; } set { _seriesPoints = value; } }
        public short Id { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public Series()
        {
            _seriesPoints = new List<DataPoint>();
        }

        public void add(DataPoint p)
        {
            if (_seriesPoints != null)
                _seriesPoints.Add(p);
            else
                throw new Exception("You must create the class first");
        }
    }
}
